import { createRouter, createWebHashHistory } from 'vue-router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { staticRoutes, notFoundAndNoPower, dynamicRoutes } from '@/router/route'
export const router = createRouter({
    history: createWebHashHistory(),
    routes: [...notFoundAndNoPower, ...staticRoutes, ...dynamicRoutes],
})

router.beforeEach(async (to, from, next) => {
    console.log(to, from)
    NProgress.configure({ showSpinner: false })
    next()
})

// 路由加载后
router.afterEach(() => {
    NProgress.done()
})

export default router
